home *** CD-ROM | disk | FTP | other *** search
- Path: dd.chalmers.se!news.chalmers.se!sunic!EU.net!howland.reston.ans.net!math.ohio-state.edu!jussieu.fr!centre.univ-orleans.fr!univ-lyon1.fr!swidir.switch.ch!scsing.switch.ch!news.dfn.de!rrz.uni-koeln.de!rrz.uni-koeln.de!teralon!dino.dinoco.de!yaps.dinoco.de!arno
- From: arno@yaps.dinoco.de (Arno Eigenwillig)
- Newsgroups: comp.sys.amiga.programmer
- Subject: cloning file handles (was: Re: SystemTagList() Problems)
- Message-ID: <7kaPu*CB1@yaps.dinoco.de>
- Date: Tue, 17 May 1994 15:34:31 +0100
- Reply-To: arno@yaps.dinoco.de
- References: <Cp2rEH.M4r@dcs.ed.ac.uk> <mwiMu*2v1@yaps.dinoco.de>
- <2qodc4$d0j@hpsystem1.informatik.tu-muenchen.de>
- <2qosqe$ftt@nemesis.jpl.nasa.gov> <2r0h9s$olb@lily.csv.warwick.ac.uk>
- Organization: Yet Another Private Site in Meckenheim, Germany
- X-Newsreader: Arn V 1.04
- Lines: 48
-
- Hi!
-
- In article <2r0h9s$olb@lily.csv.warwick.ac.uk>, Ralf writes:
-
- > BPTR DupFH(BPTR oldfh) /* never pass an exclusive fh */
- > {
- > BPTR lock,fh;
- >
- > if (lock=DupLockFromFH(oldfh))
- > {
- > if (fh=OpenFromLock(lock)) /* this does really only take 1 parm */
- > return fh;
- > UnLock(lock);
- > }
- > return 0;
- > }
-
- The above code should be perfect for usual file system files. However,
- as the original subject - SystemTagList() problems - brings back to
- mind, the original intention was to clone the current input and output
- file handles. And these are not guaranteed to be files from which a
- lock can be DupLockFromFH()'ed:
- - they may be non - file system "files" (such as a console or a pipe)
- - they may be files on a file system not supporting the underlying
- ACTION_COPY_DIR_FH packet
-
- For interactive "files" there is the way Ralph Babel demonstrates in
- his Guru Book:
-
- pr = (struct Process *)FindTask(0);
- oldcontask = pr->pr_ConsoleTask;
- pr->pr_ConsoleTask = <another handler's process ID>;
- fh = Open("*", MODE_NEWFILE);
- pr->pr_ConsoleTask = oldcontask;
-
- Similarities to Ralph's ConWindowC.c are admittedly not conincidential.
-
- However, I still hold up the statement I made in <-BhLu*7t1@yaps.dinoco.de>:
-
- > there is no general way to clone file handles
-
- Sad.
-
- -- __
- __/// Arno Eigenwillig <arno@yaps.dinoco.de>
- \XX/ MIME & PGP supported * V:+49-2225-5870
-
- Every real programmer knows that 0x2b | ~0x2b == -1.
-